package nxu.it.movieapi.service.pg;

import org.jdbi.v3.core.Jdbi;
import org.jdbi.v3.sqlobject.SqlObjectPlugin;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;

@Configuration
public class JdbiConfig {

    @Bean
    public Jdbi createJdbi(DataSource dataSource){
        return Jdbi.create(dataSource);
    }
    @Bean
    public Jdbi createSecondJdbi() {
        Jdbi jdbi = Jdbi.create("jdbc:postgresql://192.168.224.22:5432/movie_api", "api", "api");
        jdbi.installPlugin(new SqlObjectPlugin());
        return jdbi;
    }
}
